<?php
    /**
    * Dictionary Module
    * View_page action
    * @author trungdt
    * @since Jul 20l, 2011
    */

    global $db;
    // Used later, for recalculation and other things.
    if (!defined("SYS_SORTING")) require_once(BASE."subsystems/sorting.php");

    $config=null;
    $config->item_per_page=100; // for compatible only
    $title="Từ điển Kinh Thánh ";
    $view="Default";

    // Create the template
    $template = new template("dicmodule",$view,$loc);
    $template->assign("config",$config);
    
    $dfrom=1;
    $dto=100;
    if (isset($_REQUEST['dfrom']))
        {
            $dfrom=intval($_REQUEST['dfrom']);
            if ($dfrom <0)   $dfrom=1;
        }
    if (isset($_REQUEST['dto']))
    {
        $dto=intval($_REQUEST['dto']);
        if ($dto < $dfrom ) $dto = $dfrom+1;
    }
    
    $temp=$db->selectObjects("gbible_dic"," (substring(name,2)+0 >= {$dfrom}) AND (substring(name,2)+0 <= {$dto})  ORDER BY substring(name,2)+0 ASC");  
    
    //$st="Từ ".$temp[0]->name." đến ".$temp[count($temp)-1]->name;
    $st="Từ G".$dfrom." đến G".$dto;
    _ab_theme_action_register_title("Từ điển Kinh Thánh {$st}" . " - " .SITE_TITLE);
    $template->assign('data',$temp); 
    $template->register_permissions(
    array('administrate','configure','manage'),
    $loc);
    $template->assign('moduletitle', $title);
    $template->assign('from_to', $st);
    if (!(isset($_REQUEST['flow_has_set']) && ($_REQUEST['flow_has_set']==1)))
        exponent_flow_set(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
    $template->output();
?>
